#ifndef FORM_COM_JBGL_H
#define FORM_COM_JBGL_H

#include <QWidget>
#include <QSqlQuery>
#include <QMap>
#include <QSqlQueryModel>

#include "pub_pop_delay.h"

//#include <QList>

namespace Ui {
class Form_com_jbgl;
}

class Form_com_jbgl : public QWidget
{
    Q_OBJECT

public:
    explicit Form_com_jbgl(QWidget *parent = nullptr);
    ~Form_com_jbgl();

    void closeEvent(QCloseEvent *event);

signals:
    void destroyW( QString );
private slots:

    bool check_status();
    bool check_status_u();
    void clear_screen();
    void clear_screen_u();
    void calculate_group_price(QString his_code);


    void on_pb_search_drug_clicked();

    void on_tv_drug_source_clicked(const QModelIndex &index);

    void on_tv_drug_source_doubleClicked(const QModelIndex &index);

    void on_pb_gen_drug_price_list_clicked();

    void on_pb_drug_price_save_clicked();

    void on_pb_remove_item_drug_clicked();

    void on_pb_add_item_drug_clicked();

    void on_pb_exit_clicked();

    void on_pb_search_undrug_clicked();

    void on_tv_undrug_source_clicked(const QModelIndex &index);

    void on_pb_remove_item_undrug_clicked();

    void on_pb_add_item_undrug_clicked();

    void on_pb_drug_price_save_u_clicked();

    void on_pb_search_bill_clicked();

    void on_tv_bill_list_clicked(const QModelIndex &index);

    void on_le_key_undrug_returnPressed();

    void on_le_key_drug_returnPressed();

    void on_pb_gen_drug_price_list_u_clicked();

    void on_pb_export_clicked();

private:
    Ui::Form_com_jbgl *ui;

    QSqlQuery *qrm, *qro, *qrot;

    QString sq;
    QSqlQueryModel *md_drug_list, *md_drug_new_price;
    QSqlQueryModel *md_undrug_list, *md_undrug_new_price;
    QSqlQueryModel *md_bill_list, *md_bill_content;

    QString adjust_number ; //调价单号
    QString profit_flag ;//盈亏标志
    int serial_code;    //调价单内序号
    QMap<QString, QString> item_info;

    Pub_pop_delay * dlgDelay;
    QString oper_dept;

    QString last_sql; // for data export
};

#endif // FORM_COM_JBGL_H
